if (!dojo._hasResource["dojoide.workspace.OutputPane"]) {
    dojo._hasResource["dojoide.workspace.OutputPane"] = true;
    dojo.provide("dojoide.workspace.OutputPane");
    
	dojo.require('dojo.dnd.move');
	dojo.require('dijit.TitlePane');

    //OutputPane
    dojo.declare("dojoide.workspace.OutputPane", dijit.TitlePane, {
        _contentBuffer: '',
        
        moveable: null,
        
        isScrollable: false,
        
        postCreate: function(){
            this.inherited('postCreate', arguments);
            this.arrowNode.style.visibility = 'hidden';
            
            if(this.moveable && this.moveable == 'true'){
	            new dojo.dnd.Moveable(this.domNode);
            }
			
			if(this.domNode.style.height){
				this._makeScrollable();
			}
        },
        
        _makeScrollable: function(){
        	if(this.isScrollable){
        		return;
        	}
			var ifr = dojo.doc.createElement('iframe');
			ifr.id = this.id + '_iframe';
			ifr.style.border = 'none';
			ifr.frameBorder = 0;
			ifr.style.height = this.domNode.offsetHeight - (this.titleNode.offsetHeight + 15);
			ifr.style.width = '100%';

			this.containerNode.style.padding = '0';
			this.containerNode.appendChild(ifr);
			ifr.contentWindow.document.open();
			ifr.contentWindow.document.write('<html>');
			ifr.contentWindow.document.write('<body>');
			ifr.contentWindow.document.write('<style type="text/css">@import "' + dojo.config.baseUrl + 'resources/dojo.css";@import "' + dojo.config.baseUrl + '../dijit/themes/tundra/tundra.css";</style>');
			ifr.contentWindow.document.write('</body>');
			ifr.contentWindow.document.write('</html>');

			var ifrdiv = ifr.contentWindow.document.createElement('div');
            ifr.contentWindow.document.body.appendChild(ifrdiv);
			ifr.contentWindow.document.close();
            
            this.iframe = ifr;
            this.window = ifr.contentWindow;
            this.document = ifr.contentWindow.document;
            this.containerNode = ifrdiv;
            
            this.isScrollable = true;
        },

		expand: function(){
			if (!this.open){
	        	this.inherited('toggle', arguments);
			}
		},

		collapse: function(){
			if (this.open){
	        	this.inherited('toggle', arguments);
			}
		},

		toggle: function(toggle){
			//override and do nothing
		},
		
        getContent: function(){
            return this._contentBuffer;
        },
        
        append: function(str){
            this._contentBuffer = this._contentBuffer + str;
        },
        
        updateView: function(){
			if(this.domNode.style.height){
				this._makeScrollable();
			}
            this.setContent(this._contentBuffer);
			this.window.scroll(0, this.containerNode.offsetHeight);
        },
        
        hide: function(){
            this.domNode.style.visibility = 'hidden';
        },
        
        show: function(){
			if(this.domNode.style.height){
				this._makeScrollable();
			}
            this.domNode.style.visibility = 'visible';
        },
        
        isVisible: function(){
            return (this.domNode.style.visibility == 'visible');
        },
        
        isEmpty: function(){
            return (this._contentBuffer == '');
        },
        
        clear: function(){
            this._contentBuffer = '';
            this.updateView();
        },
        
        write: function(str){
            this.append(str);
            this.updateView();
        },
        
        writeLn: function(str){
            this.write(str + '<br>');
        }
        
    });
    
}
